from file_system import FileSystem
from operations import create_file, delete_file, show_file_content, write_to_file
from utils import storage_stats


def main():
    fs = FileSystem()

    while True:
        print("\n命令选项：")
        print("1. 创建文件")
        print("2. 删除文件")
        print("3. 显示文件内容")
        print("4. 写入文本到文件")
        print("5. 导入文件")
        print("6. 导出文件")
        print("7. 存储统计")
        print("0. 退出")

        choice = input("请输入操作: ")

        if choice == '1':
            file_name = input("输入文件名: ")
            create_file(file_name, fs)
        elif choice == '2':
            file_name = input("输入文件名: ")
            delete_file(file_name, fs)
        elif choice == '3':
            file_name = input("输入文件名: ")
            show_file_content(file_name, fs)
        elif choice == '4':
            file_name = input("输入文件名: ")
            text = input("输入文本内容: ")
            write_to_file(file_name, text, fs)
        elif choice == '7':
            storage_stats(fs)
        elif choice == '0':
            break
        else:
            print("无效操作！")


if __name__ == "__main__":
    main()
